package com.wetool.wechat.entity;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Getter
@Setter
@Entity
@Table
public class WechatMerchantRelation {

    /**
     * 微兔用户id
     */
    @Id()
    private long merchantId;

    /**
     * 微信全局唯一unionId
     */
    @Column
    private String unionId;

    /**
     * 微信用户在微兔公众号OpenId
     */
    @Column()
    private String officialOpenId;
    /**
     * 微信用户在微兔小程序OpenId
     */
    @Column()
    private String miniProgramOpenId;

    /**
     * 微信用户在微兔开放平台的OpenId
     */
    @Column()
    private String openPlatformOpenId;

    /**
     * 微信二维码代码
     */
    @Column()
    private String ticket;

    public WechatMerchantRelation() {
    }

    public WechatMerchantRelation(long merchantId, String ticket) {
        this.merchantId = merchantId;
        this.ticket = ticket;
    }


    public void bindingWechatAccount(String unionId, String openId) {
        this.unionId = unionId;
        this.officialOpenId = openId;
    }
}
